package it.tukano.fun;

/**
 * A function with 3 arguments that returns nothing
 * @author pgi
 * @param <P1> the first parameter's type
 * @param <P2> the second parameter's type
 * @param <P3> the third parameter's type
 */
public abstract class VFunction3<P1, P2, P3> implements Function3<P1, P2, P3, Void> {

    /**
     * Instance initializer
     */
    public VFunction3() {
    }

    /**
     * Calls doApply and returns null
     * @param p1 the first parameter of the function
     * @param p2 the second parameter of the function
     * @param p3 the third parameter of the function
     * @return null
     */
    public Void apply(P1 p1, P2 p2, P3 p3) {
        doApply(p1, p2, p3);
        return null;
    }

    /**
     * Subclasses implement this do define the function body
     * @param p1 the first argument of the function
     * @param p2 the second argument of the function
     * @param p3 the third argument of the function
     */
    protected abstract void doApply(P1 p1, P2 p2, P3 p3);
}
